using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Tracker.Mobile.Droid.TrackerWebService;

namespace Tracker.Mobile.Droid.Activities
{
    [Activity(Label = "My Activity")]
    public class BaseTabActivity : TabActivity
    {
        private ISharedPreferences _preferences;

        protected TrackerService WebService { get; private set; }

        protected int UserID
        {
            get
            {
                //return 1;
                return _preferences.GetInt(PreferenceKeys.UserID, 0);
            }
            set
            {
                _preferences.Edit().PutInt(PreferenceKeys.UserID, value).Commit();
            }
        }

        protected string Username
        {
            get
            {
                return _preferences.GetString(PreferenceKeys.Username, String.Empty);
            }
            set
            {
                _preferences.Edit().PutString(PreferenceKeys.Username, value).Commit();
            }
        }

        protected string Email
        {
            get
            {
                return _preferences.GetString(PreferenceKeys.Email, String.Empty);
            }
            set
            {
                _preferences.Edit().PutString(PreferenceKeys.Email, value).Commit();
            }
        }

        protected int Minutes
        {
            get
            {
                return _preferences.GetInt(PreferenceKeys.Minutes, 1);
            }
            set
            {
                _preferences.Edit().PutInt(PreferenceKeys.Minutes, value).Commit();
            }
        }

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            _preferences = GetSharedPreferences(Global.Preferences, FileCreationMode.Private);
            WebService = new TrackerService();
        }
    }
}